set pubdir to "Mac+:Fichiers:" -- the folder whare the files are set indexFile to {alias "Mac+:Fichiers:00index.txt"} -- the files list set inMailbox to "Entre" -- the name of the incomming mailbox set trashMailbox to "Reus et traits" -- the name of the trash mailbox we want to use set outMailbox to "Sortie" -- the name of the outgoing messages set formsMailbox to "Modles" -- the name of our forms mailbox set sysop to "robert" -- who will get the Bcc of error reports if any set returnPath to "" as string -- initialize set myType to 2 -- 0 = AppleDouble, 2 = BinHex tell application "Eudora F1.4.2" activate -- If not using the default Eudora's Settings open it here with timeout of 3600 seconds -- get the messages from server connect with check -- do we have incomming messages? set messageCount to (count mailbox named inMailbox of mail folder named "" each message) if messageCount is not 0 then -- so process them set itemNumber to 1 repeat messageCount times -- get the body of the message set messageText to (field "" of message itemNumber of mailbox inMailbox of mail folder named "") set mesageText to messageText as text set lineCount to (count the paragraphs of messageText) set lineTodo to 1 -- process each line repeat lineCount times set theLine to paragraph lineTodo of messageText set wordCount to (count the words of theLine) if wordCount is not 0 then set myCommand to the first word of theLine if (myCommand is "path") and (wordCount > 1) then set returnPath to characters 6 thru (the length of theLine) of theLine as string else if myCommand is "AppleDouble" then set myType to 0 else if myCommand is "BinHex" then set myType to 2 else if (myCommand is "help") or (myCommand is "aide") then -- Instead of attaching a file, we get -- the content of a saved message and paste -- it into the reply. reply message itemNumber of mailbox inMailbox of mail folder named "" without quotetext if returnPath is not "" then set field "To:" of message named "" to returnPath end if set the field "Subject:" of message named "" to myCommand -- now get the body of the saved message -- first locate the message itself set foundForm to 1 repeat (count mailbox named formsMailbox of mail folder named "" each message) times if the field "Subject:" of message foundForm of mailbox formsMailbox of mail folder "" contains myCommand then exit repeat else set foundForm to foundForm + 1 end if end repeat -- get the body set myForm to field "" of (message foundForm of mailbox named formsMailbox of mail folder "") -- paste it set the field "" of message named "" to myForm -- send the message queue message named "" else if myCommand is "index" then -- send the "00index.txt" file reply message itemNumber of mailbox inMailbox of mail folder named "" without quotetext if returnPath is not "" then set field "To:" of message named "" to returnPath end if set the field "Subject:" of message named "" to "Index" set the field "" of message named "" to ("This is the files list of our file server." & return & return & "To receive the help file, put the word help" & " in the body of your message." & return) set AttachType of message named "" to myType attach message named "" documentlist indexFile queue message named "" else if (myCommand is "send") and (wordCount > 1) then -- send a file reply message itemNumber of mailbox inMailbox of mail folder named "" without quotetext if returnPath is not "" then set field "To:" of message named "" to returnPath end if -- get the file name set fName to characters 6 thru (the length of theLine) of theLine as string set field "Subject:" of message named "" to fName set the field "" of message named "" to "This is the file you requested." & return & return & "To receive the help file, put the word help" & " in the body of your message, to receive our files list, " & "put the word index." & return try -- try to attach the file set AttachType of message named "" to myType attach message named "" documentlist {alias (pubdir & fName)} on error errorText -- the file wasn't there??? set the field "" of message named "" to "Error while processing the send command for the file: " & fName & ", probably because the file doesn't exists." & return & return & "To receive the help file, put the word help" & " in the body of your message, to receive our files list, " & "put the word index." & return & return & "The message returned by AppleScript: " & errorText & return set the field "Bcc:" of message named "" to sysop end try queue message named "" end if end if set lineTodo to lineTodo + 1 end repeat -- re-initialize variables set returnPath to "" as string set myType to 2 set itemNumber to itemNumber + 1 end repeat -- move messages to our trash mailbox repeat messageCount times move message 1 of mailbox inMailbox of mail folder named "" inserthere end of mailbox trashMailbox of mail folder named "" end repeat -- the same for sent messages -- after sending them set messageCount to (count mailbox named outMailbox of mail folder named "" each message) if (messageCount > 0) then connect with send repeat messageCount times move message 1 of mailbox outMailbox of mail folder named "" inserthere end of mailbox trashMailbox of mail folder named "" end repeat end if end if quit -- Bye end timeout end tell